<template>
	<view class="">
		{{JSON.stringify(this.userInfo)}}
		
		<button type="default" @click="test()" open-type="getUserInfo">test</button>
	</view>
</template>

<script>
	import {
		mapState,
		
	} from 'vuex'
	import request from '../../static/js/request.js';
	export default{
		computed:{
			...mapState(['userInfo'])
		},
		mounted() {
			// console.log(this.userInfo)
		},
		methods:{
			test(){
				let self = this;
				uni.login({
					success: function(loginRes) {
						console.log(loginRes);
						var code = loginRes.code;
						
						uni.getUserInfo({
							success: (res) => {
								console.log(res);
								let data = {
									code,
									encryptedData: res.encryptedData,
									iv: res.iv,
									vmp:'vmp'
								};
								request.post('/api/v1/signup/0', data).then(resp=>{
									
								})
							},
							fail: () => {
								console.log("未授权");
							}
						})
					}
				});
				// uni.showToast({
				// 	title:JSON.stringify(this.userInfo)
				// })
			}
		}
	}
</script>

<style>
</style>
